from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from time import sleep

url = 'http://imooc.com'

chrome_options = Options()
prefs = {'profile.managed_default_content_settings.images': 2}
chrome_options.add_experimental_option('prefs', prefs)
driver = webdriver.Chrome(chrome_options=chrome_options)

driver.get(url)

sleep(2)
html_tag = driver.find_element(By.TAG_NAME, 'html')
height = html_tag.size['height']
# print('html height:', height)
for i in range(0, height, 5):
    js_script = 'window.scrollBy(0,{})'.format(i)
    driver.execute_script(js_script)
    sleep(0.01)

sleep(5)
driver.quit()



